//package com.allwees.data.analysis.stat.mq;
//
//import com.allwees.bs.core.model.stat.req.MonthlyStatReq;
//import com.allwees.data.analysis.stat.service.MonthlyStatService;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.amqp.rabbit.annotation.RabbitHandler;
//import org.springframework.amqp.rabbit.annotation.RabbitListener;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Component;
//
//@Slf4j
//@Component
//@RabbitListener(queues = "q.B.StatTask.MonthlyStatAndSave")
//public class MonthlyStatListener {
//
//    @Autowired
//    private MonthlyStatService monthlyStatService;
//
//    @RabbitHandler
//    public void onEvent(MonthlyStatReq req) {
//        try {
//            if (req.getCount() != null) {
//                monthlyStatService.saveStat(req);
//            } else {
//                monthlyStatService.statAndSave(req);
//            }
//        } catch (Exception ex) {
//            log.error(ex.getMessage(), ex);
//            throw ex;
//        }
//    }
//}
